package org.example.algorithm.sort;

public class QuickSortAlgorithm extends AbstractSortCommon{
    @Override
    protected <T> void doSort(T arr) {

    }

    public void quickSort(int[] arr, int start, int end){
        if(start < end){
            int i = start;
            int j = end;
            int x = arr[start];
            while(i < j){
                while(i < j && arr[j] > x) j--;
                if(i < j) arr[i++] = arr[j];
                while(i < j && arr[i] < x) i++;
                if(i < j) arr[j--] = arr[i];
            }
            arr[i] = x;
            quickSort(arr, start, i - 1);
            quickSort(arr, i + 1, end);
        }
    }

    @Override
    public SortType getSortType() {
        return null;
    }
}
